package cn.webestar.scms.user.api;

import cn.webestar.scms.commons.R;
import cn.webestar.scms.commons.api.PageVO;
import cn.webestar.scms.user.api.dto.User.*;
import cn.webestar.scms.user.entity.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 用户
 */
@Tag(name = "用户")
@FeignClient(contextId = "User", name = "microsvc-user", path = "/svcapi/User")
public interface UserApi {

    @Operation(summary = "create")
    @PostMapping("create")
    R<User> create(@RequestBody UserCreateDTO body);

    @Operation(summary = "delete")
    @PostMapping("delete")
    R<Boolean> delete(@RequestParam("id") Long id);

    @Operation(summary = "update")
    @PostMapping("update")
    R<User> update(@RequestBody UserUpdateDTO body);

    @Operation(summary = "findById")
    @PostMapping("findById")
    R<User> findById(@RequestParam("id") Long id);

    @Operation(summary = "findByIds")
    @PostMapping("findByIds")
    R<Map<Long, User>> findByIds(@RequestBody Set<Long> ids);

    @Operation(summary = "page")
    @PostMapping("page")
    R<PageVO<User>> page(@RequestBody UserPageDTO body);

    @Operation(summary = "findOne")
    @PostMapping("findOne")
    R<User> findOne(@RequestBody UserSimpleDTO body);

    @Operation(summary = "limitList")
    @PostMapping("limitList")
    R<List<User>> limitList(@RequestBody UserLimitDTO body);

}
